package behavioral.visitor;

/**
 * @ClassName: MainTest
 * @Description: 测试类
 * @Author: liu-hao
 * @Date: 2023-04-10 22:59
 * @Version: 1.0
 **/
public class MainTest {
    public static void main(String[] args) {
        Element[] elements = new Element[]{
                new Book("Design Patterns", "Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides"),
                new DVD("The Shawshank Redemption", "Frank Darabont"),
                new Book("Clean Code", "Robert C. Martin")
        };

        Visitor visitor = new MyVisitor();

        for (Element element : elements) {
            element.accept(visitor);
        }
    }
}
